package com.kou.service.impl;

import com.kou.dao.CartDao;
import com.kou.dao.CartDaoImpl;
import com.kou.dao.OrderDao;
import com.kou.dao.OrderDaoImpl;
import com.kou.pojo.Cart;
import com.kou.pojo.Orders;
import com.kou.service.OrderService;

import java.util.List;

/**
 * @author SteinY
 * @create 2022-03-26 10:40
 * @description:
 */
public class OrderServiceImpl implements OrderService {
    OrderDao orderDao = new OrderDaoImpl();
    CartDao cartDao = new CartDaoImpl();
    @Override
    public void create(String uid, String aid, String sum) {
        String oid = orderDao.create(uid, aid, sum);
        List<Cart> carts = cartDao.findCarts(uid);
        orderDao.createDetail(oid,carts);

    }

    @Override
    public List<Orders> findAll(String uid) {
        return orderDao.findAll(uid);
    }

    @Override
    public Orders findById(String oid) {
        return orderDao.findById(oid);
    }

    @Override
    public List<Orders> show() {
        return orderDao.show();
    }

    @Override
    public void send(String oid) {
        orderDao.send(oid);
    }

    @Override
    public List<Orders> find(int uid, String status) {
        return orderDao.find(uid,status);
    }

    @Override
    public List<Orders> showAll() {
        return orderDao.showAll();
    }
}
